//
//  YQIncubatorHomeCell.m
//  NewRetail
//
//  Created by yuqin on 2019/7/1.
//  Copyright © 2019年 yuqin. All rights reserved.
//

#import "YQIncubatorHomeCell.h"

@implementation YQIncubatorHomeCell

- (void)setupTableViewCellView {
    [self addSubview:self.timeLab];
    [self addSubview:self.lineView];
    [self addSubview:self.dayEarnings];
    [self addSubview:self.incubatorDateLab];
    [self addSubview:self.incubatorNumLab];
    [self addSubview:self.getBenefitsBtn];

    
    [self.timeLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(kMargin_left);
        make.top.mas_equalTo(0);
        make.size.mas_equalTo(CGSizeMake(ScreenWidth-2*kMargin_left, FIT(36)));
    }];
    
    [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.equalTo(self.timeLab.mas_bottom).mas_equalTo(0);
        make.size.mas_equalTo(CGSizeMake(ScreenWidth, 1));
    }];
    
    CGFloat label_W = ScreenWidth/4.0;
    [self.dayEarnings mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.equalTo(self.lineView.mas_bottom).mas_equalTo(FIT(20));
        make.size.mas_equalTo(CGSizeMake(label_W, FIT(60)));
    }];
    
    [self.incubatorDateLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.dayEarnings.mas_right).mas_equalTo(0);
        make.top.equalTo(self.lineView.mas_bottom).mas_equalTo(FIT(20));
        make.size.mas_equalTo(CGSizeMake(label_W, FIT(60)));
    }];
    
    [self.incubatorNumLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.incubatorDateLab.mas_right).mas_equalTo(0);
        make.top.equalTo(self.lineView.mas_bottom).mas_equalTo(FIT(20));
        make.size.mas_equalTo(CGSizeMake(label_W, FIT(60)));
    }];
    
    [self.getBenefitsBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(0);
        make.top.equalTo(self.lineView.mas_bottom).mas_equalTo(FIT(20));
        make.size.mas_equalTo(CGSizeMake(label_W, FIT(40)));
    }];

    
}

- (UILabel *)timeLab {
    if (!_timeLab) {
        _timeLab = [YQViewFactory labelWithTextColor:UIColorFromRGB(0xcccccc) textAlignment:NSTextAlignmentLeft fontSize:FIT(14) userBold:NO];
        _timeLab.text = @"孵化时间：2019-06-25 18:00:00";
    }
    return _timeLab;
}

- (UIView *)lineView {
    if (!_lineView) {
        _lineView = [[UIView alloc] init];
        _lineView.backgroundColor = UIColorFromRGB(0xcccccc);
    }
    return _lineView;
}

- (UILabel *)dayEarnings {
    if (!_dayEarnings) {
        _dayEarnings = [YQViewFactory labelWithTextColor:MainBlackColor textAlignment:NSTextAlignmentCenter fontSize:FIT(14) userBold:NO];
        _dayEarnings.numberOfLines = 3;
        _dayEarnings.text = @"日化收益\n \n0.09492%";
        
        [_dayEarnings setAttributedTextWithBeforeString:@"日化收益\n \n" beforeColor:MainBlackColor beforeFont:YQ_Font(14) afterString:@"0.09492%" afterColor:MainBlueColor afterFont:YQ_Font(18)];
    }
    return _dayEarnings;
}

- (UILabel *)incubatorDateLab {
    if (!_incubatorDateLab) {
        _incubatorDateLab = [YQViewFactory labelWithTextColor:MainBlackColor textAlignment:NSTextAlignmentCenter fontSize:FIT(14) userBold:NO];
        _incubatorDateLab.text = @"孵化期\n \n360天";
        _incubatorDateLab.numberOfLines = 3;
        [_incubatorDateLab setAttributedTextWithBeforeString:@"孵化期\n \n" beforeColor:MainBlackColor beforeFont:YQ_Font(14) afterString:@"360天" afterColor:MainBlueColor afterFont:YQ_Font(18)];
        
    }
    return _incubatorDateLab;
}

- (UILabel *)incubatorNumLab {
    if (!_incubatorNumLab) {
        _incubatorNumLab = [YQViewFactory labelWithTextColor:MainBlackColor textAlignment:NSTextAlignmentCenter fontSize:FIT(14) userBold:NO];
        _incubatorNumLab.text = @"孵化数量\n \n50000";
        _incubatorNumLab.numberOfLines = 3;
        [_incubatorNumLab setAttributedTextWithBeforeString:@"孵化数量\n \n" beforeColor:MainBlackColor beforeFont:YQ_Font(14) afterString:@"50000" afterColor:MainBlueColor afterFont:YQ_Font(18)];
    }
    return _incubatorNumLab;
}

- (UIButton *)getBenefitsBtn {
    if (!_getBenefitsBtn) {
        _getBenefitsBtn = [YQViewFactory buttonWithTitle:@"领取收益" titleColor:WhiteColor fontSize:FIT(15) userBold:NO target:self sel:@selector(getBeneAction)];
        [_getBenefitsBtn setBackgroundImage:YQ_IMAGE(@"get_shouyi") forState:UIControlStateNormal];
    }
    return _getBenefitsBtn;
}

- (void)getBeneAction {
    //领取收益
}


@end
